/**
 * Created by zhuo on 2017/8/1.
 */
var express = require('express');
var router = express.Router();
// import mockCompanyData from './mockData/companysMock.json';
var roleList = require('./mockData/role.json');
var result = require("./mockData/operationResult.json");
var createAndUpdateData = {
    "message": "测试内容da78",
    "result": true,
    "role": {
        "updateTime": 48100,
        "id": "角色",
        "indexUrl": "测试内容h3t9",
        "name": "角色",
        "remark": "测试内容9274"
    }
}

/* GET users listing. */
router.get('/getRoleList', function(req, res, next) {
    console.info("get roles now...");
    res.json(roleList);
});
router.post('/create', function(req, res, next) {
    console.info("create role now...");
    res.json(createAndUpdateData);
});
router.post('/delete', function(req, res, next) {
    console.info("delete role now...:"+JSON.stringify(req.body));
    res.json(result);
});
router.post('/update', function(req, res, next) {
    console.info("update role now...");
    res.json(createAndUpdateData);
});

/**
 * ACS 2017/10/22
 */
router.post('/assignAuthority',function (req, res, next) {
    console.log(JSON.stringify(req.body.ids))
    res.end()
})
router.get('/list',function (req, res, next) {
    res.json({
        "message": 1,
        "result": 1,
        "resultData": [
            {
                "id":"1",
                "name": "小区管理员",
                "organizationTypeName": "小区/建筑群",
                "url": "住户管理;房间管理;楼宇管理;卡片管理;",
                "ctime": 1501837059487,
                "remark": "小区管理人员",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2015/4/7 14:26:59"
            },
            {
                "id":"2",
                "name": "物业安保人员",
                "organizationTypeName": "小区/建筑群",
                "url": "住户管理;房间管理;",
                "ctime": 1501837059487,
                "remark": "小区工作人员",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2015/4/8 9:15:39"
            },
            {
                "id":"3",
                "name": "物业管理人员",
                "organizationTypeName": "小区/建筑群",
                "url": "住户管理;房间管理;楼宇管理;",
                "ctime": 1501837059487,
                "remark": "小区工作人员",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2015/4/13 15:21:56"
            },
            {
                "id":"4",
                "name": "警察",
                "organizationTypeName": "公安局/派出所",
                "url": "房间管理;楼宇管理;卡片管理;",
                "ctime": 1501837059487,
                "remark": "",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2014/12/4 13:21:09"
            },
            {
                "id":"5",
                "name": "超级管理员",
                "organizationTypeName": "海辰分公司/部门",
                "url": "住户管理;房间管理;楼宇管理;卡片管理;",
                "ctime": 1501837059487,
                "remark": "系统管理人员",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2014/9/29 15:40:25"
            },
            {
                "id":"6",
                "name": "数据录入员",
                "organizationTypeName": "海辰分公司/部门",
                "url": "住户管理;房间管理;楼宇管理;卡片管理;",
                "ctime": 1501837059487,
                "remark": "系统维护人员",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2014/9/29 16:03:05"
            },
            {
                "id":"7",
                "name": "社区工作人员",
                "organizationTypeName": "居委会/村委会",
                "url": "住户管理;房间管理;楼宇管理;卡片管理;",
                "ctime": 1501837059487,
                "remark": "",
                "updateUserName": "超级管理员",
                "status": "1",
                "updateTime": "2014/9/29 16:03:05"
            }
        ]
    })
})

module.exports = router;/**
 * Created by zhuo on 2017/8/1.
 */
